package cn.edu.zjgsu.service.impl;

import cn.edu.zjgsu.dao.NovelDao;
import cn.edu.zjgsu.model.Novel;
import cn.edu.zjgsu.service.NovelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: wqmei
 * DateTime: 2017/11/10 11:15
 * Description:
 */
@Service
public class NovelServiceImpl implements NovelService
{
    @Autowired
    NovelDao novelDao;

    @Override
    public List<Novel> getNoverlList()
    {
        return novelDao.findByHQL("select novelId,novelName,category from Novel");
    }

    @Override
    public Novel getNoverlById(int novelId)
    {
        return novelDao.findById(novelId);
    }

    @Override
    public void addNovel(Novel novel)
    {
        novelDao.save(novel);
    }
}
